package com.newsvoice.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

public class RecruitmentCategoryActivity extends DashBoardActivity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.recruitment_category_activity);
		setHeader(getString(R.string.MainActivityTitle), true, true, false,
				false);
		ListView listView = (ListView) findViewById(R.id.recruitment_category_list);
		final String[] values = getResources().getStringArray(
				R.array.recruitment_category);
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
				R.layout.text_layout_item_listview, R.id.topic_text, values);

		System.out.println("oncreate mainactivity");
		listView.setAdapter(adapter);
		listView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				// TODO Auto-generated method stub
				String category = values[arg2];
				if (category.equalsIgnoreCase("công nghệ thông tin")) {
					category = "InfomationTechnologyRe";
				}
				Intent i1 = new Intent(getBaseContext(), ShowNewsActivity.class);
				i1.putExtra("category", category);
				startActivity(i1);
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

}
